#!/usr/bin/env python
# -*- coding: utf-8 -*-

from importall import lib
from concurrent.futures import ThreadPoolExecutor
import sys


def run(executor: ThreadPoolExecutor, cache_size: int = 50):
    data = 'data/fiu-meta/usr2.csv'
    for algo in (0, 1, 3,):  # (0, 1, 3)
        args = '%d %s %d --DR=1 --PR=2000' % (algo, data, cache_size)
        out = 'output/usr2.%d/%d.txt' % (algo, cache_size)
        executor.submit(lib.cas_exec, 'scratch/fiu', args, out)
    # executor.submit(lib.cas_exec, 'scratch/opt', '4 %s %d' % (data, cache_size),
    #                 'output/usr2.4/%d.txt' % (cache_size))
    return


if __name__ == '__main__':
    with ThreadPoolExecutor(max_workers=6) as executor:
        cache_size = int(sys.argv[1]) if len(sys.argv) > 1 else 50
        run(executor, cache_size)
    print('usr2 finish')
